# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from  spider.common.buildhr import Buildhr

import time
from django.db.models import Q 
class Command(BaseCommand):
   
    def handle(self, *args, **options):
        page = 1
        buildhtr = Buildhr()
        buildhtr.initSoap("http://www.buildhr.com/so/11-kc万科-sm1-p%s.html" % (page))
        print(buildhtr.getJobsUrls())
        print(buildhtr.getCompanyUrls())
   
    def handle1(self, *args, **options):
        tags = ['建造师培训']
        for tag in tags:
            i = 0
            while i<65:
                Baidu().zhidao("https://zhidao.baidu.com/search?word=%s&ie=utf-8&site=-1&sites=0&date=0&pn=%s"%(tag,i*10), tag)
                i = i+1
        
    
    def read_log(self,file):
        f = open(file,'r',encoding='utf-8')
        return f.readlines()
            
    def write_log(self, file, content):
        f = open(file,'a',encoding='utf-8')
        f.write(content)
  


    